/*
 *  IPread.h
 */

void readIPort(char *fileName, char port[STRING_SIZE], char IP[STRING_SIZE])
{
	FILE *f;
	char line[STRING_SIZE];
	int i,counter=0,index;
	bool colonFound=false;
	char colon=':';
	
	
	if((f=fopen(fileName,"r"))==NULL)
	  {
		  perror("IPread: opening configuration file failed.");
		  exit(-1);
	  }
	fgets(line,STRING_SIZE,f);
	fclose(f);
	
	for(i=0;i<strlen(line);i++)
	  {
		  if(colonFound)
			  break;
		  if(line[i]!=colon)
			{
				IP[counter]=line[i];
				counter++;
			}
		  else
			{
				colonFound=true;
				index=i;
				break;
			}
	  }
	counter=0;
	for(i=index+1;i<strlen(line);i++)
	  {
		  port[counter]=line[i];
		  counter++;
	  }
	 IP[12]='\0';
	 port[5]='\0';
	
}
